﻿/*
 * Summary:
 *   indexer for maintaining sports items and 
 *   supporting binary searching by unique ID
 *   
 * History:
 *   Date           Author      Changes
 *   23/10/2010     YIWEI YU    Created
 */

using System;
using System.Collections;

namespace AcmeSportsStore
{
    class SportsItemIndexerById : Indexer
    {
        public class Comparer : IComparer
        {
            public int Compare(object x, object y)
            {
                SportsItem siX = (SportsItem)x;
                SportsItem siY = (SportsItem)y;

                return siX.Id.CompareTo(siY.Id);
            }
        }

        public readonly static Comparer IdComparer = new Comparer();

        public SportsItemIndexerById()
            : base(IdComparer, IdComparer)
        {
        }
    }
}
